package richbar.com.richbar.adapter.order;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by QiYang on 2018/11/29.
 */

public class MainAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;
    private String[] titles;
    public MainAdapter(String[] titles,List<Fragment> fragments,FragmentManager fm) {
        super(fm);
        this.fragments = fragments;
        this.titles = titles;
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        //super.destroyItem(container, position, object);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}

